package com.zhuss.product.processor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import com.zhuss.bean.vo.product.line.DetailLineVo;
import com.zhuss.enums.StartStopEnum;
import com.zhuss.enums.新线招募类型;
import com.zhuss.exception.DzcxException;


@Component("lineCheck")
public class LineCheck {
	
	@Autowired
	@Qualifier("lineRead")
	private LineRead lineRead;

	
	public boolean checkStart(Long lineId) throws DzcxException {
		DetailLineVo line = ((DetailLineVo) lineRead.detail(lineId));
		if (StartStopEnum.停用.sameKey(line.getStatus())) {
			return true;
		}
		return false;
	}
	
	public boolean checkStop(Long lineId) throws DzcxException {
		DetailLineVo line = ((DetailLineVo) lineRead.detail(lineId));
		if (StartStopEnum.启用.sameKey(line.getStatus())) {
			return true;
		}
		return false;
	}
	
	public boolean checkEnable(Long lineId) throws DzcxException {
		DetailLineVo line = ((DetailLineVo) lineRead.detail(lineId));
		if (新线招募类型.新线招募.sameKey(line.getPretype())) {
			return true;
		}
		return false;
	}
	
}
